<template>
  <div class="gk-layout-container">
    <div class="gk-layout-header">
    <!-- 工具栏-->
    	<s-query perms="sys:log"   @click="findPage"  > 
        <el-form-item>
          <el-input v-model="filters.info"
                    placeholder="任务号条码"></el-input>
        </el-form-item>
           <el-form-item>
          <el-input v-model="filters.tableName"  placeholder="集合名称"></el-input>
        </el-form-item>
       </s-query>
    </div>


   <div class="gk-layout-main">
      <my-table :data="pageResult.content" class='gk-main-table' :height=250  v-loading="loading"  :size="global.gSize"  align="left"   style="width:100%;" >
          <column   prop="eId" label="编号"   />
          
          <column   prop="keyCode" label="任务号条码"   :formatter="this.selectionFormat"/>
          <column    prop="ticks" label="时间"     />
      </my-table>
  </div>
  <!--分页栏-->
        <div class="toolbar gk-layout-footer"  style="padding:10px;">
        
          <el-pagination layout="total, prev, pager, next, jumper"  @current-change="findPage"
                        :current-page="filters.pageNum"
                        :page-size="filters.pageSize"
                        :total="pageResult.totalSize"
                        style="float:right;">
          </el-pagination>
        </div>


  </div>
</template>

<script>
import KtButton from "@/views/Core/KtButton"
import { format } from "@/utils/datetime"
import MyTable from "@/views/Core/MyTable"
import Column from "@/views/Core/Column"
    import SQuery from "@/components/Kj/SQuery" 
	    import SReflash from "@/components/Kj/SReflash"
export default {
  components: {
    KtButton,
    MyTable,
    Column,SQuery,SReflash
  },
  data () {
    return {

      loading:false,
      filters: {
        id: '',
        tableName: '',
        time: '', pageNum: 1, pageSize: 200 
      },
      
      
      dataForm: {
        id: 0,
        name: '',
        type: '',
        code: ''
      },

     
      pageResult: {},
      showOperation: false
    }
  },
  methods: {
    // 获取分页数据
    findPage: function (data) {
       if(data!=-1){
				this.filters.pageNum=data	
			}
	 
      this.$api.wcslog.wcsFindEquipmentPage(this.filters).then((res) => {
       var content= res.data.content;
        for(var i=0;i<content.length;i++){
          var d = content[i];
          var info = ""
          for( var k in d){
            if(k!="_id"&&k!="ticks"&&k!="keyCode"&&k!="eId"){
              info+=k+":"+d[k]+",";
            }

            d.info=info
          }
        }
        this.pageResult = res.data
      }) 
    },


    selectionFormat: function (row, column, cellValue, index) {
      let key = ""
      let propt = column.property;
      let val = row["keyCode"];
      let info = row["info"];
      return "["+val+"]==>"+info
    },
    
    // 时间格式化
    dateFormat: function (row, column, cellValue, index) {
      var time =row[column.property];
      time=(time-621355968000000000)/10000
     
      time=parseInt(time);
      time-=8*3600*1000
      return format(time)
    }
  },
  mounted () {
    var d =new Date()
    var MM=d.getMonth()+1;
    if(MM<10){
      MM="0"+MM;
    }

    var DD=d.getDate();
    if(DD<10){
      DD="0"+DD;
    }
    this.filters.tableName="status"+d.getFullYear()+MM
    	this.findPage(1)
  }
}
</script>

